<template>
	<view class="box padding-l-r-30">
		<view v-for="(item,index) in list" :key="index" class="list" @click="goDetails(item)">
			<view class="img-box">
				<image :src="BASE_URL + item.image" mode="aspectFill"></image>
			</view>
			<view class="padding-20">
				<view class="title">{{item.title}}</view>
				<view class="content">{{item.content}}</view>
				<view class="flex-box">
					<text>S</text>
					<view class="community-name flex-1 only-1">{{item.admin.nickname}}</view>
					<view class="time"> {{item.createtime}}</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
    import {artList} from '@/api/home.js'
    import $baseUrl from "@/config/index.js"
    const BASE_URL = $baseUrl.baseUrl
	export default {
		data() {
			return {
				list :[ ],
                page:1,
                BASE_URL
			}
		},
        onShow() {
           this.initList()
        },
		methods: {
            initList(){
                this.list = []
                this.page = 1
                this.geArtList()
            },
            geArtList(){
                artList({page:this.page,limit:10}).then(res=>{
                    this.list = this.list.concat(res.data)
                })
            },
			goDetails(item){
				uni.navigateTo({
					url:'/pageA/consulting/details?id=' + item.id
				})
			}
		}
	}
</script>

<style scoped lang="scss">
	.box {
		min-height: 100vh;
		background: #F5F5F5;
		.list {
			margin-bottom: 20rpx;
			border-radius: 14rpx;
			overflow: hidden;
			background-color: #fff;
			.img-box {
				image {
					width: 100%;
					height: 250rpx;
				}
			}
		}
        .title {
            font-size: 30rpx;
			color: #000;
        }
		.content {
			margin: 12rpx 0 20rpx;
			font-size: 26rpx;
			color: #707070;
		}
		.flex-box {
			align-items: center;
			text {
				width: 30rpx;
				height: 30rpx;
				border-radius: 50%;
				color: #fff;
				text-align: center;
				font-size: 20rpx;
				line-height: 30rpx;
				background: #43ABC4;
			}
			.community-name {
				max-width: 500rpx;
				padding: 0 8rpx;
				font-size: 24rpx;color: #000;
			}
			.time {
				font-size: 24rpx;color: #666;
			}
		}
	}
</style>
